<?php
	class School_campus extends MY_controller{

		function __construct(){
			parent::__construct();
		}

		function index($limit = 0){
			$this->load->model("School_model");
			$condition['school_id'] = $this->school_id;
			$campus_list = $this->School_model->get_school_campus($this->school_id, $limit, $offset = 20);
			$this->load->library('pagination');
			$page_config['base_url'] = '/school_campus/index';
			$page_config['total_rows'] = $campus_list['count'];
			$page_config['per_page'] = $offset;
			$page_config['uri_segment'] = 3;
			$this->pagination->initialize($page_config);
			$pagination = $this->pagination->create_links();
			$this->smarty->assign("campus_list", $campus_list['result']);

			$conditions = array('category_id' => 0, "school_id" => $this->school_id, "type" => 2);
			$hot_question = $this->Questions->get_question_list(0, $offset, $conditions);
			$this->smarty->assign("hot_question", $hot_question['result']);

			$new_list = $this->Newses->get_news10($this->school_id);
			$this->smarty->assign("new_list", $new_list);
			
			$this->smarty->assign("pagination", $pagination);
			$this->smarty->display("school_campus/list.html");
		}
	}